#include <iostream>
#include <pthread.h>

using namespace std;

typedef void (*CB)();

class Thread
{
public:
    static void* RunThread(void* args)
    {
        Thread* ptr = static_cast<Thread*>(args);
        ptr->_cb();
    }

public:
    Thread(CB cb)
    :_cb(cb)
    {
        pthread_create(&tid,nullptr,RunThread,this);
    }

    void join()
    {
        pthread_join(tid,nullptr);
    }

private:
    pthread_t tid;
    CB _cb;
};